package com.jilefojing.beans.enums;

public enum GenderEnum {
	MALE((short) 1, "男"), FEMALE((short) 2, "女"), UNKNOWN((short) 0, "未知");

	private short code;
	private String msg;

	private GenderEnum(short code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public short getCode() {
		return code;
	}

	public void setCode(short code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public static GenderEnum getGenderEnumByCode(short code) {
		for (GenderEnum _enum : GenderEnum.values()) {
			if (_enum.getCode() == code) {
				return _enum;
			}
		}
		return GenderEnum.UNKNOWN;
	}

}
